package cn.fantasy;

/**
 * @author ET
 * @description TODO
 * @date 2023/4/26 9:29
 * @Version V1.0
 */
public class ThreadLocalTest {
    public static void main(String[] args) throws InterruptedException {
        for (int i = 0; i < 10; i++) {
            int finalI = i;
            new Thread(() -> {
                ThreadLocal<Integer> objectThreadLocal = new ThreadLocal<>();
                objectThreadLocal.set(finalI);
                System.out.println(objectThreadLocal.get());
            }).start();
        }
          Thread.sleep(5000);

    }

}
